import dayjs from "dayjs";
const disabledDate = (current) => {
  // Can not select days before today and today
  return current && current < dayjs().startOf("day");
};
function getcolumns(setdrawer) {
  return {
    columns: [
      {
        title: "合同编号",
        dataIndex: "contract_number",
        key: "contract_number",
        formItemProps: {
          rules: [{ required: true, message: "此项为必填项" }],
        },
      },
      {
        title: "合同名称",
        dataIndex: "name",
        key: "name",
        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
      },
      {
        title: "开始日期",
        dataIndex: "start_date",
        key: "start_date",
        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
        valueType: "date",
        fieldProps: {
          disabledDate,
        },
        search: false,

      },
      {
        title: "结束日期",
        dataIndex: "end_date",
        key: "end_date",
        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
        valueType: "date",
        fieldProps: {
          disabledDate,
        },
        search: false,

      },
      {
        title: "是否周期性",
        dataIndex: "is_loop",
        key: "is_loop",
        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
        valueType: "radio",
        options: [
          { label: "是", value: true },
          { label: "否", value: false },
        ],
      },
      {
        title: "循环类型",
        dataIndex: "loop_type",
        key: "loop_type",
        formItemProps: {
          rules: [{ required: true, message: "此项为必填项" }],
        },
        hideInForm: { is_loop: [false] },
        valueType: "select",
        options: [
          { label: "日", value: "day" },
          { label: "周  ", value: "week" },
          { label: "月", value: "month" },
          { label: "年", value: "year" },
        ],
      },
      {
        title: "维保总费用",
        dataIndex: "total_cost",
        key: "total_cost",
        valueType: "money",
        search: false,

        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
      },
      {
        title: "地址",
        dataIndex: "address",
        key: "address",
        valueType: "textarea",
        colProps: { span: 24 },
        search: false,

        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
      },
      {
        title: "维保项目",
        dataIndex: "projects",
        key: "projects",
        colProps: { span: 24 },
        valueType: "formList",
        search: false,
        hideInTable: true,
        formItemProps: { rules: [{ required: true, message: "此项为必填项" }] },
        columns: [
          {
            title: "项目名称",
            dataIndex: "name",
            key: "name",
            colProps: {
              span: 12,
            },
          },
          {
            title: "项目说明",
            dataIndex: "remark",
            key: "remark",
            colProps: {
              span: 12,
            },
          },
        ],
      },
    ],
    pathconfig: {
      enableadd: true,
      enableedit: true,
      enabledelete: true,
      enabledetail: false,
      add: "/contract",
      edit: "/contract",
      list: "/contract",
      delete: "/contract",
      detail: "",
    },
  };
}
export default getcolumns;
